home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / dviware / dvi2ps / dvi-to-ps / gf.h < prev    next >
C/C++ Source or Header  |  1990-10-01  |  5KB  |  105 lines

  1. #ifndef USEPXL
  2. /* modified by Peter Damron 1987 University of Washington */
  3. /*---------------------------------------------------------------------*/
  4. /* $Header: gf.h,v 2.0 88/06/07 15:02:17 peterd Rel2 $ */
  5. /*---------------------------------------------------------------------*/
  6. /* This file contains routines for reading character descriptions from
  7.    GF files (the output of Metafont).  The following functions are defined:
  8.    gf_gettochar() finds the next character, returns its code (reduced modulo
  9.         256 if necessary), and sets global variables gf_min_m, gf_max_m,
  10.         gf_min_n, gf_max_n.  A result of -1 indicates that there are no
  11.         more characters and the postamble has been found.
  12.    gf_readbits() After a character is found, this routine fills array gf_bits[]
  13.         with the character image.  The image is represented in
  14.         Postscript format: the bits are packed into bytes
  15.         (most significant bit first), and the bytes scan the image
  16.         left-to-right, bottom-to-top.
  17.         Set globals gf_num_cols, gf_num_rows, gf_x_offset, gf_y_offset
  18.         (the latter give the offset of the origin from the upper
  19.         bottom corner of the image, up being a positive gf_y_offset).
  20.    gf_readpost() After the postamble is found, this routine reads it and
  21.         sets the remaining global variables declared below.
  22.    gf_seekpost() rapidly finds the postamble by random accessing the file.
  23.    gf_seekchar(c) uses fseek() to find a character with code c (modulo 256),
  24.         returning a nonzero result if successful.  Global variables
  25.         are set as they are by gf_gettochar.  GF files may contain
  26.         many characters with the same code, in which case subsequent
  27.         calls to gf_seekchar(c) with the same c will find the other
  28.         versions.  This routine should only be called after gf_readpost().
  29.    No random access is attempted if gf_seekpost() and gf_seekchar() are not used.
  30. */
  31. /*---------------------------------------------------------------------*/
  32. /* forward declarations */
  33.  
  34. extern int  gf_gettochar();
  35. extern void gf_readbits();
  36. extern void gf_readpost();
  37. extern void gf_seekpost();
  38. extern int  gf_seekchar();
  39.  
  40. /* these should be supplied by the main routine */
  41. extern void Fatal();
  42. extern void Warning();
  43.  
  44. /*---------------------------------------------------------------------*/
  45.  
  46. #ifndef MAXCHARS
  47. /* maximum characters per font file */
  48. #define MAXCHARS    256
  49. #endif MAXCHARS
  50.  
  51. #define int32 long
  52.  
  53. /*---------------------------------------------------------------------*/
  54. /* these variables initialized by gf_gettochar() and gf_seekchar() */
  55.  
  56. extern int gf_min_m;        /* bounding box for character */
  57. extern int gf_max_m;        /* bounding box for character */
  58. extern int gf_min_n;        /* bounding box for character */
  59. extern int gf_max_n;        /* bounding box for character */
  60. extern int32 gf_charfam;    /* high order bytes of character code */
  61.  
  62. /*---------------------------------------------------------------------*/
  63. /* these variables initialized by gf_readpost() */
  64.  
  65. extern int gf_font_min_m;        /* overall bounds */
  66. extern int gf_font_max_m;        /* overall bounds */
  67. extern int gf_font_min_n;        /* overall bounds */
  68. extern int gf_font_max_n;        /* overall bounds */
  69. extern int32 designsize;    /* font size in points scaled by 1<<20 */
  70. extern int32 gf_checksum;    /* should match TFM file and DVI file */
  71. extern int32 gf_hppp;        /* horizontal pixels/point scaled 1<<16 */
  72. extern int32 gf_vppp;        /* vertical pixels/point scaled 1<<16 */
  73.  
  74. extern int gf_char_wd[MAXCHARS];    /* char width in pixels, rounded if necessary */
  75. extern int32 gf_tfm_wd[MAXCHARS];    /* width as a fraction of designsize scaled 1<<20 */
  76. extern char gf_char_exists[MAXCHARS];    /* nonzero indicates presence of a char_loc */
  77. extern int gf_bc;    /* first and last nonzero gf_char_exists entries */
  78. extern int gf_ec;    /* first and last nonzero gf_char_exists entries */
  79.  
  80. extern int32 gf_char_pointer[MAXCHARS];    /* used by gf_seekchar() */
  81.  
  82. /*---------------------------------------------------------------------*/
  83.  
  84. extern void bad_gf();    /* aborts the program if the gf file is invalid */ 
  85. extern FILE *gf_infile;    /* change this externally if necessary */
  86. extern char *gf_filename;    /* name of current gf file */
  87.  
  88. /*---------------------------------------------------------------------*/
  89. /* these variables initialized by gf_readbits() */
  90.  
  91. #define BITBUFSIZE 20000
  92.  
  93. extern unsigned char gf_bits[BITBUFSIZE];    /* the char bitmap */
  94. extern int gf_num_cols;                /* columns in bitmap */
  95. extern int gf_num_rows;                /* rows in bitmap */
  96. extern int gf_num_bytes;            /* bytes in bitmap */
  97. extern int gf_x_offset;                /* char offset in bitmap */
  98. extern int gf_y_offset;                /* char offset in bitmap */
  99.  
  100. extern int gf_rowbytes;                /* bytes/row in bitmap */
  101.  
  102. /*---------------------------------------------------------------------*/
  103. #endif USEPXL
  104.  
  105.